package com.jtlrm.ckd.net;

import com.base.sdk.base.entity.RequestResult;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.config.UrlConstants;
import com.jtlrm.ckd.entity.AddYinShiEntity;
import com.jtlrm.ckd.entity.ApkUpdateEntity;
import com.jtlrm.ckd.entity.ByPhoneHuanZheInfo;
import com.jtlrm.ckd.entity.CodeEntity;
import com.jtlrm.ckd.entity.CreateGroupEntity;
import com.jtlrm.ckd.entity.DataShenHeEntity;
import com.jtlrm.ckd.entity.GroupDetailEntity;
import com.jtlrm.ckd.entity.GroupEntity;
import com.jtlrm.ckd.entity.GroupMemberEntity;
import com.jtlrm.ckd.entity.HuanZheEntity;
import com.jtlrm.ckd.entity.ImUserEntity;
import com.jtlrm.ckd.entity.LiangBiaoEntity;
import com.jtlrm.ckd.entity.NewListEntity;
import com.jtlrm.ckd.entity.ShengHuaCheckEntity;
import com.jtlrm.ckd.entity.ShengHuaZhiBiaoEntity;
import com.jtlrm.ckd.entity.ShiWuEntity;
import com.jtlrm.ckd.entity.ShiWuPicEntity;
import com.jtlrm.ckd.entity.ShiWuTypeEntity;
import com.jtlrm.ckd.entity.ShuJuShenHeDetailEntity;
import com.jtlrm.ckd.entity.ShuJuShenHePicEntity;
import com.jtlrm.ckd.entity.SuiFangPaiBanEntity;
import com.jtlrm.ckd.entity.ThreeDataEntity;
import com.jtlrm.ckd.entity.WorkerEntity;
import com.jtlrm.ckd.entity.YinShiDetailEntity;
import com.jtlrm.ckd.entity.YinShiTuPianEntity;
import com.jtlrm.ckd.entity.YingYangDetailData;
import com.jtlrm.ckd.entity.YingYangEntity;
import com.jtlrm.ckd.entity.YingYangHistoryEntity;
import com.jtlrm.ckd.entity.YongCanTypeEntity;
import com.jtlrm.ckd.entity.HospitalEntity;
import com.jtlrm.ckd.entity.HuanZheBasicDataEntity;
import com.jtlrm.ckd.entity.HuanZheInfoEntity;
import com.jtlrm.ckd.entity.ListEntity;
import com.jtlrm.ckd.entity.LoginResult;
import com.jtlrm.ckd.entity.NewFileEntity;
import com.jtlrm.ckd.entity.NewsEntity;
import com.jtlrm.ckd.entity.PageEntity;
import com.jtlrm.ckd.entity.ResultData;
import com.jtlrm.ckd.entity.UserEntity;
import com.jtlrm.ckd.entity.YanZhengMaEntity;
import com.jtlrm.ckd.entity.YinShiDataEntity;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;

/**
 * date:    2017/9/14
 * description: retrofit的请求接口定义
 */

public interface ApiService {

    //请求参数一次性传入（通过Map来存放参数名和参数值）
    @FormUrlEncoded
    @POST(UrlConstants.LOGIN)
    Observable<LoginResult> login(@Field("grant_type") String grant_type, @Field("client_id") String client_id
            , @Field("scope") String scope, @Field("client_secret") String client_secret, @Field("username") String username
            , @Field("password") String password);

    @FormUrlEncoded
    @POST(UrlConstants.LOGIN)
    Observable<LoginResult> getToken(@Field("grant_type") String token, @Field("client_id") String id, @Field("client_secret") String client_secret);

    @POST(UrlConstants.GET_USER_INFO)
    Observable<RequestResult<UserEntity>> getUserInfo();

    @POST(UrlConstants.SEND_MESSAGE)
    Observable<RequestResult<YanZhengMaEntity>> sendMessgae(@Body JsonObject jsonObject);

    @POST(UrlConstants.SEND_FORGET_MESSAGE)
    Observable<RequestResult<YanZhengMaEntity>> sendForgetMessgae(@Body JsonObject jsonObject);

    @POST(UrlConstants.REBUILD_PASSWORD)
    Observable<RequestResult> rebuildPassword(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_HOSPITAL)
    Observable<RequestResult<List<HospitalEntity>>> queryHospital(@Body JsonObject jsonObject);

    @POST(UrlConstants.REGISTER)
    Observable<RequestResult<List<HospitalEntity>>> register(@Body RequestBody jsonObject);

    @POST(UrlConstants.CHNAGE_BIRTHDAY)
    Observable<RequestResult> changeBirthday(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHNAGE_PHONE)
    Observable<RequestResult> changePhone(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHNAGE_PASSWORD)
    Observable<RequestResult> changePassword(@Body JsonObject jsonObject);

    @POST(UrlConstants.QR_CODE)
    Observable<RequestResult<String>> queryQRCode();


    @POST(UrlConstants.UPLOAD_HEADER)
    Observable<RequestResult> uploadHeader(@Body JsonObject jsonObject);

    @Multipart
    @POST(UrlConstants.UPLOAD_FILE)
    Observable<RequestResult<NewFileEntity>> uploadImage(@Part MultipartBody.Part dir, @Part MultipartBody.Part file);


    @GET(UrlConstants.NEWS_LIST + "/{num}/{size}/{categoryId}")
    Observable<RequestResult<ResultData<ListEntity<NewsEntity>>>> getNewsByCategory(@Path("num") int num, @Path("size") int size, @Path("categoryId") int categoryId);

    @GET(UrlConstants.NEWS_LIST_SORT + "/{num}/{size}/{sortKey}/{sortDirection}")
    Observable<RequestResult> getNewsBySort(@Path("num") int num, @Path("size") int size, @Path("sortKey") String sortKey, @Path("sortDirection") int sortDirection);

    @POST(UrlConstants.QUERY_HUANZHE_BY_KEYWORD)
    Observable<RequestResult<PageEntity<List<HuanZheInfoEntity>>>> queryHuanZheListByKeyWords(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_HUANZHE_BASIC)
    Observable<RequestResult<HuanZheBasicDataEntity>> queryHuanZheBasic(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_LIANG_BIAO_LIST)
    Observable<RequestResult<PageEntity<List<LiangBiaoEntity>>>> queryLiangBiaoList(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_YING_YANG_LIST)
    Observable<RequestResult<PageEntity<List<YingYangEntity>>>> queryYingYangList(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_CODE)
    Observable<RequestResult<List<CodeEntity>>> queryCode(@Body JsonObject jsonObject);


    @POST(UrlConstants.APK_UPDATE)
    Observable<RequestResult<ApkUpdateEntity>> queryAppVersion(@Body JsonObject jsonObject);

    @POST(UrlConstants.HUAN_ZHE_JIANDANG)
    Observable<RequestResult<String>> createHuanZhe(@Body RequestBody jsonObject);

    @POST(UrlConstants.QUERY_HUANZHE_BY_PHONE)
    Observable<RequestResult<ByPhoneHuanZheInfo>> queryHuanZheListByKeyPhone(@Body JsonObject jsonObject);

    @POST(UrlConstants.SEVEN_DATA_LIST)
    Observable<RequestResult<List<YinShiDataEntity>>> querySevenYinShiData(@Body JsonObject jsonObject);

    @POST(UrlConstants.THREE_STATICTS)
    Observable<RequestResult<List<ThreeDataEntity>>> queryThreeYinShiData(@Body JsonObject jsonObject);

    @POST(UrlConstants.YONG_CAN_TYPE)
    Observable<RequestResult<List<YongCanTypeEntity>>> queryYongCanType();

    @POST(UrlConstants.YONG_CAN_DETAIL)
    Observable<RequestResult<List<YinShiDetailEntity>>> queryYinShiDetail(@Body JsonObject jsonObject);


    @POST(UrlConstants.YONG_CAN_TU_PIAN)
    Observable<RequestResult<List<YinShiTuPianEntity>>> queryYinShiTupian(@Body JsonObject jsonObject);

    @POST(UrlConstants.YIN_SHI_PIC)
    Observable<RequestResult<List<ShiWuPicEntity>>> queryYinShiPic(@Body JsonObject jsonObject);

    @POST(UrlConstants.SHI_WU_TYPE)
    Observable<RequestResult<List<ShiWuTypeEntity>>> queryShiWuType();

    @POST(UrlConstants.SHI_WU_ALL)
    Observable<RequestResult<List<ShiWuEntity>>> queryAllFood();


    @POST(UrlConstants.ADD_YIN_SHI)
    Observable<RequestResult<AddYinShiEntity>> addYinShi(@Body RequestBody jsonObject);


    @POST(UrlConstants.CHANGE_YIN_SHI)
    Observable<RequestResult<String>> changeYinShi(@Body RequestBody jsonObject);

    @POST(UrlConstants.DELETE_YIN_SHI)
    Observable<RequestResult<String>> deleteYinShi(@Body JsonObject jsonObject);


    @POST(UrlConstants.SHENGHUA_QUERY_DATE)
    Observable<RequestResult<List<ShengHuaCheckEntity>>> queryShengHuaDate(@Body JsonObject jsonObject);


    @POST(UrlConstants.QUERY_SHENGHUA_ZHiBIAO)
    Observable<RequestResult<List<ShengHuaZhiBiaoEntity>>> queryShengHuaZhiBiao();


    @POST(UrlConstants.SUBMIT_SHENG_HUA_DATA)
    Observable<RequestResult<String>> submitShengHuaData(@Body RequestBody jsonObject);

    @POST(UrlConstants.QUERY_SHENGHUA_DETAIL_BYID)
    Observable<RequestResult<List<ShengHuaZhiBiaoEntity>>> queryShengHuaDateById(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHECK_SHENGHUA_SUBMIT_DATE)
    Observable<RequestResult<String>> checkShengHuaRiQi(@Body JsonObject jsonObject);

    @POST(UrlConstants.YINGYANG_HISTORY)
    Observable<RequestResult<PageEntity<List<YingYangHistoryEntity>>>> queryYingYangHistory(@Body JsonObject jsonObject);

    @POST(UrlConstants.ADD_YING_YANG)
    Observable<RequestResult<YingYangDetailData>> addYingYang(@Body RequestBody jsonObject);

    @POST(UrlConstants.UPDATE_YING_YANG)
    Observable<RequestResult<YingYangDetailData>> updateYingYang(@Body RequestBody jsonObject);

    @POST(UrlConstants.DELETE_YING_YANG)
    Observable<RequestResult<Object>> deleteYingYang(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_TODAY_YINGYANG)
    Observable<RequestResult<YingYangDetailData>> queryTodayYingYang(@Body JsonObject jsonObject);


    @POST(UrlConstants.QUERY_SUI_FANG_PAI_BAN_HUANZHE)
    Observable<RequestResult<PageEntity<List<SuiFangPaiBanEntity>>>> querySuiFangPaiBan(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_SUI_FANG_PAI_BAN)
    Observable<RequestResult<List<SuiFangPaiBanEntity>>> querySuiFangPaiBanList(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_ADD_SUI_FANG_PAI_BAN)
    Observable<RequestResult<PageEntity<List<SuiFangPaiBanEntity>>>> queryAddSuiFang(@Body JsonObject jsonObject);

    @POST(UrlConstants.ADD_SUI_FANG)
    Observable<RequestResult<String>> addSuiFangPaiBan(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHANGE_SUI_FANG)
    Observable<RequestResult<String>> changeSuiFangPaiBan(@Body JsonObject jsonObject);

    @POST(UrlConstants.DELETE_SUI_FANG)
    Observable<RequestResult<String>> deleteSuiFangPaiBan(@Body JsonObject jsonObject);

    @POST(UrlConstants.DATA_SHENHE_LIST)
    Observable<RequestResult<PageEntity<List<DataShenHeEntity>>>> queryDataShenHeList(@Body JsonObject jsonObject);

    @POST(UrlConstants.SHEN_HE_DATA)
    Observable<RequestResult<String>> shenHeData(@Body JsonObject jsonObject);


    @POST(UrlConstants.SHU_JU_SHEN_HE_DETAIL)
    Observable<RequestResult<List<ShuJuShenHeDetailEntity>>> queryShuJuShenHeDetail(@Body JsonObject jsonObject);

    @POST(UrlConstants.SHU_JU_SHEN_HE_PICTURE)
    Observable<RequestResult<List<ShuJuShenHePicEntity>>> queryShuJuShenHeDetailPic(@Body JsonObject jsonObject);


    @POST(UrlConstants.QUERY_NEWS_LIST)
    Observable<RequestResult<List<NewListEntity>>> queryNewsList();


    @POST(UrlConstants.QUERY_SUI_FANG_RENSHU)
    Observable<RequestResult<String>> querySuiFangRenShu();

    @POST(UrlConstants.QUERY_SHEN_HE_RENSHU)
    Observable<RequestResult<String>> queryShenHeRenShu();

    @POST(UrlConstants.QUERY_HUAN_ZHE)
    Observable<RequestResult<List<HuanZheEntity>>> queryHuanZhe(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_WORKER)
    Observable<RequestResult<List<WorkerEntity>>> queryWorker(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHANGE_REMARK)
    Observable<RequestResult<Object>> changeRemark(@Body JsonObject jsonObject);

    @POST(UrlConstants.CREATE_GROUP)
    Observable<RequestResult<CreateGroupEntity>> createGroup(@Body RequestBody jsonObject);

    @POST(UrlConstants.QUERY_GROUP)
    Observable<RequestResult<List<GroupEntity>>> queryGroup(@Body JsonObject jsonObject);

    @POST(UrlConstants.ADD_HOSPITAL_GROUP)
    Observable<RequestResult<String>> addHospitalGroup(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_GROUP_MENBER)
    Observable<RequestResult<List<GroupMemberEntity>>> queryGroupMember(@Body JsonObject jsonObject);

    @POST(UrlConstants.EXIT_GROUP)
    Observable<RequestResult<Object>> exitGroup(@Body JsonObject jsonObject);

    @POST(UrlConstants.CHANGE_GROUP_NAME)
    Observable<RequestResult<Object>> changeGroupName(@Body JsonObject jsonObject);


    @POST(UrlConstants.QUERY_GROUP_DETAIL)
    Observable<RequestResult<GroupDetailEntity>> queryGroupDetail(@Body JsonObject jsonObject);


    @POST(UrlConstants.DELETE_GROUP_MEMBER)
    Observable<RequestResult<Object>> deleteGroupMember(@Body JsonObject jsonObject);


    @POST(UrlConstants.ADD_GROUP_MEMBER)
    Observable<RequestResult<Object>> addGroupMember(@Body RequestBody jsonObject);

    @POST(UrlConstants.QUERY_HOSPITAL_GROUP)
    Observable<RequestResult<List<GroupEntity>>> queryHospitalGroup(@Body JsonObject jsonObject);

    @POST(UrlConstants.QUERY_USER_INFO_BY_IMID)
    Observable<RequestResult<ImUserEntity>> queryUserInfoByImId(@Body JsonObject jsonObject);

    @POST(UrlConstants.UPDATE_SHENGHUA_SHUJU)
    Observable<RequestResult<String>> updateShengHua(@Body RequestBody jsonObject);
}
